using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace TradingLab.Data
{
    [Serializable]
    public class TickerData:Dictionary<string,PropertyBoxData>
    {
        public TickerData()
        {
        }

        public TickerData(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        public void MergeWith(TickerData tickerData)
        {
            foreach (KeyValuePair<string, PropertyBoxData> propertyBoxName_PropertyBoxData in tickerData)
            {
                if (!ContainsKey(propertyBoxName_PropertyBoxData.Key))
                {
                    Add(propertyBoxName_PropertyBoxData.Key, propertyBoxName_PropertyBoxData.Value);
                }
                else
                {
                    this[propertyBoxName_PropertyBoxData.Key].MergeWith(propertyBoxName_PropertyBoxData.Value);
                }
            }
        }
    }
}